/**
 * @param {string} s
 * @return {string}
 */
 var makeFancyString = function(s) {
  const arr = s.split('')
  const n = arr.length
  let i = 0
  while(i < n){
    let j = i+1
    while(arr[j] === arr[i]){
      j++
    }
    if(j-i > 1){
      for(let k = i+2; k<j; k++){
        arr[k] = ''
      }
    }
    i = j
  }
  return arr.join('')
};